package com.wuwei.tms.utils;

import lombok.SneakyThrows;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Component
public class MyUtils {


    @SneakyThrows
    public static LocalDateTime myDateFormatt(String dateString) {
        if (!"_".equals(dateString)) {
            String dateTimeStr = dateString + "T00:00:00";
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
            LocalDateTime dateTime = LocalDateTime.parse(dateTimeStr, formatter);
            return dateTime;
        }
        return null;
    }
}
